package com.xlh.enums.cases;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 点赞/取消赞的码值枚举类
 *
 * @author cheer
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum JudgeEnum {

    LIKE(0, 1),
    CANCEL(1, -1);

    private Integer code;

    private int operating;

    public static JudgeEnum getByCode(Integer code) {
        for (JudgeEnum judgeEnum : JudgeEnum.values()) {
            if (Objects.equals(judgeEnum.getCode(), code)) {
                return judgeEnum;
            }
        }
        return null;
    }
}
